const fs = require('fs');

fs.readFile("./goods.json", "utf8", (err, data) => {
    if (err === null) {
        let newData = JSON.parse(data);
        let arr = [];
        newData.RECORDS.map((item, index) => {
            if (item.IMAGE1 !== null) {
                arr.push(item);
            }
        });
        fs.writeFile("./newGoods.json", JSON.stringify(arr), err => {
            if (err) {
                console.log("写入文件操作失败");
            } else {
                console.log("写入文件操作成功");
            }
        })
    }
})